import { reqGetSearchGoodsInfoData } from "@/api"

const state={
  goodsInfo:{}
}
const actions={
//根据参数来获取搜索数据
async getSearchGoodsInfoData({commit},searchParams){
  const res=await reqGetSearchGoodsInfoData(searchParams);
  console.log(res)
  if(res.code==200){
    commit("SAVE_GOODS_INFO_DATA",res.data)
  }
}



}
const mutations={
  SAVE_GOODS_INFO_DATA(state,goodsInfo){
    state.goodsInfo=goodsInfo
  }
}
const getters={
//商品列表
goodsList(state){
 return state.goodsInfo.goodsList

},
//属性列表
attrsList(state){
  return state.goodsInfo.attrsList
},
//商品品牌的列表
trademarkList(state){
  
  return state.goodsInfo.trademarkList
}
,
//总页数
total(state){
  return state.goodsInfo.total
}


}
export default{
  namespaced:true,//开启命名空间
  state,
  actions,
  mutations,
  getters
}